{include file="public/header" /}
<div class="page">
    <div class="fixed-empty"></div>
    <form id="notice_form" method="POST">
        <table class="ds-default-table">
            <tbody>
                <tr class="noborder">
                    <td class="required w120"><label>{$Think.lang.notice_index_send_type}: </label></td>
                    <td class="vatop rowform"><ul class="nofloat">
                            <li>
                                <label><input type="radio" checked="" value="1" name="send_type">{$Think.lang.notice_index_spec_member}</label>
                            </li>
                            <li>
                                <label><input type="radio" value="2" name="send_type" />{$Think.lang.notice_index_all_member}</label>
                            </li>
                        </ul>
                    </td>
                    <td class="vatop tips"></td>
                </tr>
            </tbody>
            <tbody id="user_list">
                <tr class="noborder">
                    <td class="required"><label class="validation" for="user_name">{$Think.lang.notice_index_member_list}: </label></td>
                    <td class="vatop rowform"><textarea id="user_name" name="user_name" rows="6" class="tarea" >{:str_replace(' ','+',$Request.param.member_name)}</textarea></td>
                    <td class="vatop tips">{$Think.lang.notice_index_member_tip}</td>
                </tr>
            </tbody>
            <tbody id="msg">
                <tr class="noborder">
                    <td class="required"><label class="validation">{$Think.lang.notice_index_content}: </label></td>
                    <td class="vatop rowform"><textarea name="content1" rows="6" class="tarea"></textarea></td>
                    <td></td>
                </tr>
            </tbody>
            <tfoot>
                <tr class="tfoot">
                    <td colspan="15"><input class="btn" type="submit" value="{$Think.lang.ds_submit}"/></td>
                </tr>
            </tfoot>
        </table>
    </form>
</div>
<script>
$(document).ready(function(){
    $('#notice_form').validate({
        errorPlacement: function(error, element){
            error.appendTo(element.parent().parent().find('td:last'));
        },
        rules : {
            user_name : {
                required : check_user_name
            },
            content1 :{
                required : true
            }
        },
        messages : {
            user_name :{
                required     : '{$Think.lang.notice_index_member_error}'
            },
            content1 :{
                required : '{$Think.lang.notice_index_content_null}'
            }
        },
        submitHandler: function(form) {
            form.submit();
        }
    });
    function check_user_name()
    {
        var rs = $(":input[name='send_type']:checked").val();
        return rs == 1 ? true : false;
    }

    $("input[name='send_type']").click(function(){
        var rs = $(this).val();
        switch(rs)
        {
            case '1':
                $('#user_list').show();
                break;
            case '2':
                $('#user_list').hide();
                break;
        }
    });
});
</script>